package leetcode.每日一题;

import org.junit.Test;

/**
 * @author ：zsy
 * @date ：Created 2022/12/12 10:27 PM
 * @description：
 */
public class 最少操作使数组递增 {
    @Test
    public void test() {

    }

    class Solution {
        public int minOperations(int[] nums) {
            int res = 0;
            for (int i = 1; i < nums.length; i++) {
                if (nums[i] <= nums[i - 1]) {
                    int tmp = nums[i];
                    nums[i] = nums[i - 1] + 1;
                    res += nums[i] - tmp;
                }
            }
            return res;
        }
    }
}
